//
//  BasicInformationViewController.m
//  marrymarry
//
//  Created by lsj on 16/9/22.
//  Copyright © 2016年 cf. All rights reserved.
//
static NSString * headCellID  = @"BasicInforHeadTableViewCell";
static NSString * baseInfoCellID = @"BasicInorDetialTableViewCell";
static NSString * textViewCellID = @"MyTextViewTableViewCell";
static NSString * contanctCellID  = @"ContanctTableViewCell";
#import "BasicInformationViewController.h"
#import "BasicInforHeadTableViewCell.h"
#import "BasicInorDetialTableViewCell.h"
#import "MyTextViewTableViewCell.h"
#import "ContanctTableViewCell.h"
#import "ChoseOtherViewController.h"
#import "HZLocation.h"
#import "HZAreaPickerView.h"
#import "CFinfoModel.h"
#import "XPRZViewController.h"
#import "DicModel.h"
#import "TopUpViewController.h"
#import "HeadImgViewController.h"
@interface BasicInformationViewController ()<UITableViewDataSource,UITableViewDelegate,UIPickerViewDataSource,UIPickerViewDelegate,HZAreaPickerDelegate,UITextFieldDelegate,UITextViewDelegate>
{
    int _goreloadNum;
     BOOL _cutYB;
    BOOL _isFirstin;
    NSString * _niChenStr;
    NSString * _NBStr;
    int _signNum;
    ///基本资料
    NSMutableDictionary *_myBaeDic;
    ///经济状况
    NSMutableDictionary *_myMoneyDic;
    ///择偶标准
    NSMutableDictionary *_myZeOuDic;
    ///婚姻观念
    NSMutableDictionary * _myHunYinGNDic;

    int _clickTag;
    BOOL _goJump;
}
@property (weak, nonatomic) IBOutlet UITableView *myTableView;
@property (weak, nonatomic) IBOutlet UIPickerView *myPickView;
@property (weak, nonatomic) IBOutlet UIDatePicker *datePickView;
@property (weak, nonatomic) IBOutlet UIView *baseTanView;
@property (strong, nonatomic) UIPickerView * pickNewView;
@property (strong,nonatomic) HZLocation *hzLocation;
@property (strong, nonatomic) HZAreaPickerView *locatePicker;
@property (nonatomic,strong) NSArray * SettingArry;
@property (nonatomic, strong) NSArray *stringsArray;
@property (nonatomic,strong) NSMutableDictionary * myUserDic;
@property (nonatomic, strong) CFinfoModel * myUseModel;
@property (nonatomic,strong) DicModel * myDicModel;

@property (weak, nonatomic) IBOutlet UIView *grayView;
@property (weak, nonatomic) IBOutlet UILabel *myTitleLabel;

@property (weak, nonatomic) IBOutlet UIView *myAlertBaseView;
/** 提示框窗口 **/
@property (weak, nonatomic) IBOutlet UIView *myAlertInfoView;
/** 提示框八叉按钮 **/
@property (weak, nonatomic) IBOutlet UIButton *AlertCancelBtn;
/** 提示框信息 **/
@property (weak, nonatomic) IBOutlet UILabel *AlertLabel;
/** 提示框确定按钮 **/
@property (weak, nonatomic) IBOutlet UIButton *SureBtn;
/** 提示取消除按钮 **/
@property (weak, nonatomic) IBOutlet UIButton *AlertdeleBtn;

@end

@implementation BasicInformationViewController
-(NSArray *)SettingArry
{
    if (!_SettingArry) {
        _SettingArry = [NSArray new];
        if (self.isGoToBaseInforTable) {
            if (self.isGoToOther) {
                _SettingArry = @[@"用户ID",@"真实姓名",@"身份",@"用户昵称",@"期望结婚时间",@"出生日期",@"婚姻状况",@"有无子女",@"恋爱经历",@"学历",@"职业",@"星座",@"身高",@"体重",@"血型",@"工作生活所在",@"籍贯",@"户籍",@"民族",@"信仰",@"吸烟",@"喝酒"];
            }else{
            _SettingArry = @[@"用户昵称",@"期望结婚时间",@"出生日期",@"婚姻状况",@"有无子女",@"恋爱经历",@"学历",@"职业",@"星座",@"身高",@"体重",@"血型",@"工作生活所在",@"籍贯",@"户籍",@"民族",@"信仰",@"吸烟",@"喝酒"];
            }
        }else if(self.isGoToZeOu)
        {
            _SettingArry = @[@"期望结婚时间",@"工作生活所在",@"学历",@"年龄",@"身高",@"外形",@"户籍",@"年收入",@"婚姻状况",@"婚后要求",@"寻找的她/他是一位",@"喝酒",@"吸烟"];
        }else if (self.isGoToHunYinGuanNian)
        {
            _SettingArry = @[@"婚前子女",@"为爱迁居",@"婚姻态度",@"婚后关系",@"婚后异性密友",@"婚后想要小孩吗",@"婚后教育小孩",@"发现另一半有一夜情怎处理",@"婚后家务",@"家庭卫生",@"婚后消费观念",@"对方家庭重要吗",@"工作态度",@"喜欢养宠物吗",@"婚后跟父母的家庭关系",@"希望婚后朋友生活圈",@"认为两人相处最重要是(多选)",@"最看重对方那一点(多选)"];
        }else if (self.isGoToQinMiShiJiao)
        {
            _SettingArry = @[@"您认为自己性感吗？",@"认为性感主要体现在那些方面？",@"性爱方面经验",@"对待性爱态度",@"性爱中尝试新姿势态度",@"认为性和爱的关系",@"寻找的她（他）应该是一位(多选)",@"对方调动你的性致主要是(多选)",@"能够接受伴侣(多选)"];
        }else if (self.isGoToDate)
        {
            _SettingArry = @[@"初次约会希望做什么(多选)",@"约会谁买单",@"喜欢的约会场所(多选)",@"交往中最浪漫的事情(多选)",@"感兴趣话题(多选)",@"愿意参与的体育运动(多选)"];
        }
        else{
            _SettingArry = @[@"年收入",@"存款情况",@"房产情况",@"私家用车",@"资产认证"];
        }
    }
    return  _SettingArry;
}
-(NSArray*)stringsArray
{
    if (!_stringsArray) {
        self.stringsArray = [NSArray new];
    }
    return _stringsArray;
}

-(DicModel*)myDicModel
{
    if (!_myDicModel) {
        self.myDicModel =[DicModel new];
    }
    return _myDicModel;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    if (self.isGoToOther) {
        self.saveBtn.hidden =YES;
        self.myAlertBaseView.hidden = NO;
    }else{
        self.saveBtn.hidden = NO;
        self.myAlertBaseView.hidden = YES;
    }
    _isFirstin = NO;
    self.myUseModel =[CFinfoModel new];
    self.myUserDic = [NSMutableDictionary new];
    self.view.backgroundColor =[UIColor whiteColor];
    if (self.isGoToOther) {
        self.myUserDic = [Tools getValueFromNSUserDefaultsByKey:OTHER_BIGGEST_INFO_DIC];
    }else{
        self.myUserDic = [self.myUseModel readBiggestDic];
    }
    
    NSLog(@"self.myUserDic ====  %@",self.myUserDic);
    _myBaeDic = [[NSMutableDictionary alloc]initWithDictionary:self.myUserDic[@"user"]];
    if (self.isGoToBaseInforTable) {
        [self.myUseModel saveTheUserBaseDic:_myBaeDic];
    }else if (self.isGoToZeOu)
    {
        if ([self.myUserDic[@"mateStandard"] isKindOfClass:[NSString class]]) {
            _myZeOuDic = [[NSMutableDictionary alloc]initWithDictionary:@{}];
        }else{
        _myZeOuDic = [[NSMutableDictionary alloc]initWithDictionary:self.myUserDic[@"mateStandard"]];
        }
        [self.myUseModel saveTheUsualDic:_myZeOuDic andWithDicName:MY_ZEOU_DIC];
        self.myTitleLabel.text = @"择偶标准";
        
    }else if(self.isGoToHunYinGuanNian)
    {
        if ([self.myUserDic[@"marriageConcept"] isKindOfClass:[NSString class]]) {
            _myHunYinGNDic = [[NSMutableDictionary alloc]initWithDictionary:@{}];
        }else{
            _myHunYinGNDic = [[NSMutableDictionary alloc]initWithDictionary:self.myUserDic[@"marriageConcept"]];
            NSLog(@"_myHunYinGNDic ======= %@",_myHunYinGNDic);
        }
        [self.myUseModel saveTheUsualDic:_myHunYinGNDic andWithDicName:MY_HUNYINGUANNIAN_DIC];
        self.myTitleLabel.text =@"婚姻观念";
    }else if (self.isGoToQinMiShiJiao)
    {
        if ([self.myUserDic[MY_QINGMI_DIC] isKindOfClass:[NSString class]]) {
            _myHunYinGNDic = [[NSMutableDictionary alloc]initWithDictionary:@{}];
        }else{
            _myHunYinGNDic = [[NSMutableDictionary alloc]initWithDictionary:self.myUserDic[MY_QINGMI_DIC]];
        }
        [self.myUseModel saveTheUsualDic:_myHunYinGNDic andWithDicName:MY_QINGMI_DIC];
        
        self.myTitleLabel.text = @"亲密视角";
        
    }else if (self.isGoToDate)
    {
        if ([self.myUserDic[MY_DATE_DIC] isKindOfClass:[NSString class]]) {
            _myHunYinGNDic = [[NSMutableDictionary alloc]initWithDictionary:@{}];
        }else{
            _myHunYinGNDic = [[NSMutableDictionary alloc]initWithDictionary:self.myUserDic[MY_DATE_DIC]];
        }
        [self.myUseModel saveTheUsualDic:_myHunYinGNDic andWithDicName:MY_DATE_DIC];
        self.myTitleLabel.text = @"约会交往";
    }else if (self.isGoToMyAdvantage)
    {
        self.myTitleLabel.text= @"我的优势";
        
    }
    else if (self.isGoToFriendLookMe)
    {
        self.myTitleLabel.text= @"朋友看我";
        
    }
    else if (self.isGoToContancet)
    {
        self.myTitleLabel.text = @"手机号";
    }
    else if (self.isGoToWeChat)
    {
        self.myTitleLabel.text = @"微信号";
    }
    else if (self.isGoToQQ)
    {
        self.myTitleLabel.text = @"QQ号";
    }
    else{
        
        _myMoneyDic = [[NSMutableDictionary alloc]initWithDictionary:self.myUserDic[@"money"]];
        [self.myUseModel saveTheMoneyDic:_myMoneyDic];
        self.myTitleLabel.text = @"经济状况";
    }

    if (!self.isGoToZeOu) {
        [self.myTableView registerNib:[UINib nibWithNibName:headCellID bundle:nil] forCellReuseIdentifier:headCellID];
    }
   
        [self.myTableView registerNib:[UINib nibWithNibName:baseInfoCellID bundle:nil] forCellReuseIdentifier:baseInfoCellID];
    [self.myTableView registerNib:[UINib nibWithNibName:textViewCellID bundle:nil] forCellReuseIdentifier:textViewCellID];
    [self.myTableView registerNib:[UINib nibWithNibName:contanctCellID bundle:nil] forCellReuseIdentifier:contanctCellID];
    
}

- (IBAction)gobackVC:(UIButton *)sender {
    [self.navigationController popViewControllerAnimated:YES];
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    if (self.isGoToZeOu||self.isGoToHunYinGuanNian||self.isGoToQinMiShiJiao||self.isGoToDate||self.isGoToMyAdvantage||self.isGoToFriendLookMe||self.isGoToQQ||self.isGoToContancet||self.isGoToWeChat||self.isGoToJinJiInforTable||self.isGoToOther) {
        return 1;
    }else{
    return 2;
    }
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    
    if (section ==0)
    {
        if (self.isGoToZeOu||self.isGoToHunYinGuanNian||self.isGoToQinMiShiJiao||self.isGoToDate||self.isGoToJinJiInforTable||self.isGoToOther) {
              return self.SettingArry.count;
        }
        else{return 1;}
    }
    else
    {
        return self.SettingArry.count;
        
    }
   
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0)
    {
        if (self.isGoToZeOu == NO && (self.isGoToBaseInforTable)&&!self.isGoToOther) {
            BasicInforHeadTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:headCellID];
            if (!cell) {
                cell = [[BasicInforHeadTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:headCellID];
            }
            [cell loadheadPicWithDic:self.myUserDic];
            return cell;
        }
        ///婚姻观念cell
        else if (self.isGoToHunYinGuanNian)
        {
            BasicInorDetialTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:baseInfoCellID];
            if (!cell) {
                cell = [[BasicInorDetialTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:baseInfoCellID];
                
            }
            /** 设置是否是查看别人的选项 **/
            if (self.isGoToOther) {
                cell.isGoToOther = YES;
                
            }else{
                cell.isGoToOther = NO;
            }
            [cell loadTheViewWithArry:self.SettingArry andIndexPath:indexPath andDic:_myHunYinGNDic andMyKeyArry:self.myUseModel.marryGNKeyArry andIsOther:self.isGoToOther];
            if (self.isGoToOther) {
                if (self.isVip||_cutYB) {
                    
                }else{
                    if (indexPath.row == 4||indexPath.row == 7|| indexPath.row == 11 || indexPath.row == 14 ||indexPath.row == 17) {
                        cell.writeLabel.text = @"查看";
                    }
                }
            }
            if (_isFirstin) {
                if (indexPath.row == _signNum) {
                    cell.writeLabel.text = _NBStr;
                }
            }
            return cell;
            
        }
        ///亲密视角
        else if(self.isGoToQinMiShiJiao)
        {
            BasicInorDetialTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:baseInfoCellID];
            if (!cell) {
                cell = [[BasicInorDetialTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:baseInfoCellID];
                
            }
            /** 设置是否是查看别人的选项 **/
            if (self.isGoToOther) {
                cell.isGoToOther = YES;
            }else{
                cell.isGoToOther = NO;
            }

            [cell loadTheViewWithArry:self.SettingArry andIndexPath:indexPath andDic:_myHunYinGNDic andMyKeyArry:self.myUseModel.thinkKeyArry andIsOther:self.isGoToOther];
            if (self.isGoToOther) {
                if (self.isVip||_cutYB) {
                    
                }else{
                    if (indexPath.row == 0) {
                        cell.writeLabel.text = @"查看";
                    }
                }
            }
            if (_isFirstin) {
                if (indexPath.row == _signNum) {
                    cell.writeLabel.text = _NBStr;
                }
            }
            return cell;
        }
        ///约会交往
        else if(self.isGoToDate)
        {
            BasicInorDetialTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:baseInfoCellID];
            if (!cell) {
                cell = [[BasicInorDetialTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:baseInfoCellID];
                
            }
            /** 设置是否是查看别人的选项 **/
            if (self.isGoToOther) {
                cell.isGoToOther = YES;
            }else{
                cell.isGoToOther = NO;
            }

            [cell loadTheViewWithArry:self.SettingArry andIndexPath:indexPath andDic:_myHunYinGNDic andMyKeyArry:self.myUseModel.dateKeyArry andIsOther:self.isGoToOther];
            if (self.isGoToOther) {
                if (self.isVip||_cutYB) {
                    
                }else{
                    if (indexPath.row == 0) {
                        cell.writeLabel.text = @"查看";
                    }
                }
            }

            
            if (_isFirstin) {
                if (indexPath.row == _signNum) {
                    cell.writeLabel.text = _NBStr;
                }
            }
            return cell;
        }
        ///我的优势
        else if(self.isGoToMyAdvantage)
        {
            MyTextViewTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:textViewCellID];
            if (!cell) {
                cell = [[MyTextViewTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:textViewCellID];
            }
            /** 如果是查看别人 让textView失效 **/
            if (self.isGoToOther) {
                cell.myTextView.userInteractionEnabled = NO;
            }else{
                cell.myTextView.userInteractionEnabled = YES;
            }
            cell.myTextView.delegate = self;
            cell.myTextView.text = self.myUserDic[@"user"][MY_ADVANTAGE_KEY];
            cell.myTextStrCountLabel.text = [NSString stringWithFormat:@"%lu/300",cell.myTextView.text.length];
            cell.myTextStrCountLabel.tag = 777 ;
            
            return cell;
        }
        ///朋友看我
        else if(self.isGoToFriendLookMe)
        {
            MyTextViewTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:textViewCellID];
            if (!cell) {
                cell = [[MyTextViewTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:textViewCellID];
            }
            /** 如果是查看别人 让textView失效 **/
            if (self.isGoToOther) {
                cell.myTextView.userInteractionEnabled = NO;
            }else{
                cell.myTextView.userInteractionEnabled = YES;
            }
            cell.myTextView.delegate = self;
            cell.myTextView.text = self.myUserDic[@"user"][FRIEND_LOOKME_KEY];
            cell.myTextStrCountLabel.text = [NSString stringWithFormat:@"%lu/300",cell.myTextView.text.length];
            cell.myTextStrCountLabel.tag = 777 ;
            
            return cell;
        }
        else if (self.isGoToContancet)
        {
            
            ContanctTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:contanctCellID];
            if (!cell) {
                cell = [[ContanctTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:contanctCellID];
            }
            /** 如果是查看别人 让textView失效 **/
            if (self.isGoToOther) {
                cell.myContanctTextField.userInteractionEnabled = NO;
            }else{
                cell.myContanctTextField.userInteractionEnabled = YES;
            }
            cell.myContanctTextField.placeholder = @"请填写手机号";
            cell.myContanctTextField.tag = 3001;
            cell.myContanctTextField.delegate =self;
            cell.myContanctTextField.text = self.myUserDic[CONTANCT_DIC_KEY][CELLPHONE_KEY];
            return cell;
        }else if (self.isGoToWeChat)
        {
            ContanctTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:contanctCellID];
            if (!cell) {
                cell = [[ContanctTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:contanctCellID];
            }
            /** 如果是查看别人 让textView失效 **/
            if (self.isGoToOther) {
                cell.myContanctTextField.userInteractionEnabled = NO;
            }else{
                cell.myContanctTextField.userInteractionEnabled = YES;
            }
            cell.myContanctTextField.text = self.myUserDic[CONTANCT_DIC_KEY][WECHAT_KEY];
            cell.myContanctTextField.placeholder = @"请填写微信号";
            cell.myContanctTextField.delegate =self;
            cell.myContanctTextField.tag = 3002;
            
            return cell;
 
        }
        else if (self.isGoToQQ)
        {
            ContanctTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:contanctCellID];
            if (!cell) {
                cell = [[ContanctTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:contanctCellID];
            }
            /** 如果是查看别人 让textView失效 **/
            if (self.isGoToOther) {
                cell.myContanctTextField.userInteractionEnabled = NO;
            }else{
                cell.myContanctTextField.userInteractionEnabled = YES;
            }
            cell.myContanctTextField.placeholder = @"请填写QQ号";
            cell.myContanctTextField.tag = 3003;
            cell.myContanctTextField.delegate =self;
            cell.myContanctTextField.text = self.myUserDic[CONTANCT_DIC_KEY][QQ_KEY];
            return cell;
        }
        else if (self.isGoToJinJiInforTable)
        {
            BasicInorDetialTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:baseInfoCellID];
            if (!cell) {
                cell = [[BasicInorDetialTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:baseInfoCellID];
                
            }
            /** 设置是否是查看别人的选项 **/
            if (self.isGoToOther) {
                cell.isGoToOther = YES;
            }else{
                cell.isGoToOther = NO;
            }
            [cell loadTheViewWithArry:self.SettingArry andIndexPath:indexPath andDic:_myMoneyDic andMyKeyArry:self.myUseModel.moneyArry andIsOther:self.isGoToOther];
            if (_isFirstin) {
                if (indexPath.row == _signNum) {
                    cell.writeLabel.text = _NBStr;
                }
            }
        return cell;

        }
        else if (self.isGoToBaseInforTable)
        {
            BasicInorDetialTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:baseInfoCellID];
            if (!cell) {
                cell = [[BasicInorDetialTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:baseInfoCellID];
                
            }
            
            ///基本资料cell
            if (self.isGoToBaseInforTable) {
                /** 设置是否是查看别人的选项 **/
                NSLog( @"_myBaeDic ========  %@",_myBaeDic);
                if (self.isGoToOther) {
                    cell.isGoToOther = self.isGoToOther;
                        [cell loadTheViewWithArry:self.SettingArry andIndexPath:indexPath andDic:_myBaeDic andMyKeyArry:self.myUseModel.otherMyKeyArry andIsOther:self.isGoToOther];
                    
                        if (indexPath.row == 3) {
                            cell.myTextField.delegate =self;
                            cell.myTextField.tag = 600;
                        }
                        if (_isFirstin) {
                            if (indexPath.row == _signNum) {
                                cell.writeLabel.text = _NBStr;
                            }
                        }
                    
                }
                else{
                    cell.isGoToOther = NO;
                    [cell loadTheViewWithArry:self.SettingArry andIndexPath:indexPath andDic:_myBaeDic andMyKeyArry:self.myUseModel.myKeyArry andIsOther:self.isGoToOther];
                    if (indexPath.row == 0) {
                        cell.myTextField.delegate =self;
                        cell.myTextField.tag = 600;
                    }
                    if (_isFirstin) {
                        if (indexPath.row == _signNum) {
                            cell.writeLabel.text = _NBStr;
                        }
                    }
                }
           
            }
            return cell;
            

        }
        ///择偶标准的cell
        else
        {
            BasicInorDetialTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:baseInfoCellID];
            if (!cell) {
                cell = [[BasicInorDetialTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:baseInfoCellID];
                
            }
            /** 设置是否是查看别人的选项 **/
            if (self.isGoToOther) {
                cell.isGoToOther = YES;
            }else{
                cell.isGoToOther = NO;
            }
            [cell loadTheViewWithArry:self.SettingArry andIndexPath:indexPath andDic:_myZeOuDic andMyKeyArry:self.myUseModel.otherArry andIsOther:self.isGoToOther];
            if (_isFirstin) {
                if (indexPath.row == _signNum) {
                    cell.writeLabel.text = _NBStr;
                }
            }
            return cell;
    
        }
       
    }
    else if (indexPath.section == 1)
    {
        BasicInorDetialTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:baseInfoCellID];
        if (!cell) {
            cell = [[BasicInorDetialTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:baseInfoCellID];
            
        }
        
        ///基本资料cell
        if (self.isGoToBaseInforTable) {
            /** 设置是否是查看别人的选项 **/
            if (self.isGoToOther) {
                cell.isGoToOther = YES;
                if (indexPath.row == 0) {
                    cell.setTitleLabel.text = @"用户ID";
                    cell.writeLabel.text = _myBaeDic[@"user"][@"userId"];
                }else if (indexPath.row ==1)
                {
                    cell.setTitleLabel.text =@"真实姓名";
                    
                }
                else if (indexPath.row == 2)
                {
                    cell.setTitleLabel.text = @"身份";
                    
                }else{
                    cell.isGoToOther = NO;
                    [cell loadTheViewWithArry:self.SettingArry andIndexPath:indexPath andDic:_myBaeDic andMyKeyArry:self.myUseModel.myKeyArry andIsOther:self.isGoToOther];
                    if (indexPath.row == 0) {
                        cell.myTextField.delegate =self;
                        cell.myTextField.tag = 600;
                    }
                    if (_isFirstin) {
                        if (indexPath.row == _signNum) {
                            cell.writeLabel.text = _NBStr;
                        }
                    }

                }
            }
            else{
                cell.isGoToOther = NO;
                [cell loadTheViewWithArry:self.SettingArry andIndexPath:indexPath andDic:_myBaeDic andMyKeyArry:self.myUseModel.myKeyArry andIsOther:self.isGoToOther];
                if (indexPath.row == 0) {
                    cell.myTextField.delegate =self;
                    cell.myTextField.tag = 600;
                }
                if (_isFirstin) {
                    if (indexPath.row == _signNum) {
                        cell.writeLabel.text = _NBStr;
                    }
                }
            }
    
        }
        ///经济情况cell
        else{
            /** 设置是否是查看别人的选项 **/
            if (self.isGoToOther) {
                cell.isGoToOther = YES;
            }else{
                cell.isGoToOther = NO;
            }
            [cell loadTheViewWithArry:self.SettingArry andIndexPath:indexPath andDic:_myMoneyDic andMyKeyArry:self.myUseModel.moneyArry andIsOther:self.isGoToOther];
            if (_isFirstin) {
                if (indexPath.row == _signNum) {
                    cell.writeLabel.text = _NBStr;
                }
            }
        }
        return cell;
    }
    else
    {
        BasicInforHeadTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:headCellID];
        if (!cell) {
            cell = [[BasicInforHeadTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:headCellID];
        }
        [cell loadheadPicWithDic:self.myUserDic];
        return cell;
        
    }
    
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section == 0) {
        return  0;
    }else if (section == 1 )
    {
        return 10;
    }else{
        return 0;
    }
   
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (self.isGoToZeOu== NO && (self.isGoToBaseInforTable)) {
        if (self.isGoToOther) {
            return 60;
        }else{
        if (indexPath.section == 0) {
            return 120;
        }else
        {
            return 60;
        }
        }
    }else if (self.isGoToMyAdvantage)
    {
        return 260;
    }
    else
    {
        return 70;
    }
    
    
    
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (self.isGoToOther) {
        if (self.isVip) {
            
        }else{
            if (self.isGoToHunYinGuanNian) {
                if (indexPath.row == 4||indexPath.row == 7|| indexPath.row == 11 || indexPath.row == 14 ||indexPath.row == 17) {
                    switch (indexPath.row) {
                        case 4:
                            _clickTag = AFTERMARRYMIYOU_SIGNSTR;
                            break;
                        case 7:
                            _clickTag = FINDOTHERONENIGHT_SIGNSTR;
                            break;
                        case 11:
                            _clickTag = OTHERFAMILY_SIGNSTR;
                            break;
                        case 14:
                            _clickTag = AFTERWITHPARENTS_SIGNSTR;
                            break;
                        case 17:
                            _clickTag = MOSTIMPORTANT_SIGNSTR;
                            break;
                            
                        default:
                            break;
                    }
                    [self showAlertWithSignStr:@"payOneYB"];
                }
            }
            else if (self.isGoToDate)
            {
                if (indexPath.row == 0) {
                    _clickTag = FIRSTMEETTODO_SIGNSTR;
                    [self showAlertWithSignStr:@"payOneYB"];
                }
            }else if (self.isGoToQinMiShiJiao)
            {
                if (indexPath.row == 1||indexPath.row == 2|| indexPath.row == 3|| indexPath.row == 4 ||indexPath.row == 7) {
                    switch (indexPath.row) {
                        case 1:
                            _clickTag = THINKESEX_SIGNSTR;
                            break;
                        case 2:
                            _clickTag = SEXEXP_SIGNSTR;
                            break;
                        case 3:
                            _clickTag = SEXTOUHGHT_SIGNSTR;
                            break;
                        case 4:
                            _clickTag = SEXZISHI_SIGNSTR;
                            break;
                        case 7:
                            _clickTag = OTHERINTERSET_SIGNSTR;
                            break;
                            
                        default:
                            break;
                    }
                    [self showAlertWithSignStr:@"payOneYB"];
                }
            }
        }
        
        
    }else{

    if (self.isGoToBaseInforTable) {
                if (indexPath.section == 0) {
                    UIStoryboard * headSB = [UIStoryboard storyboardWithName:@"HeadImgViewController" bundle:nil];
                    HeadImgViewController * headVC = [headSB instantiateViewControllerWithIdentifier:@"HeadImgViewController"];
                    self.hidesBottomBarWhenPushed = YES;
                    [self.navigationController pushViewController:headVC animated:YES];
                }
        
        if (indexPath.section == 1 && indexPath.row != 0&&indexPath.row != 2&&indexPath.row!= 8 && indexPath.row!=12 &&indexPath.row != 13 && indexPath.row!= 14 &&indexPath.row != 6) {
            CFinfoModel * infoModel = [CFinfoModel new];
            
            self.stringsArray = infoModel.bigArry[indexPath.row];
            self.baseTanView.hidden = NO;
            self.pickNewView = [[UIPickerView alloc]initWithFrame:self.myPickView.frame];
            self.pickNewView.backgroundColor = [UIColor whiteColor];
            self.pickNewView.tag = indexPath.row;
            [self.pickNewView selectRow:0 inComponent:0 animated:YES];
            self.pickNewView.delegate =self;
            self.pickNewView.dataSource = self;
            _NBStr = self.stringsArray[0];
            [self.baseTanView addSubview:self.pickNewView];
            self.myTableView.userInteractionEnabled = NO;
            self.grayView.hidden = NO;
            _signNum = (int)indexPath.row;
        }else if (indexPath.row == 12 || indexPath.row == 13 || indexPath.row ==14 )
        {
            
            self.locatePicker = [[HZAreaPickerView alloc] initWithStyle:HZAreaPickerWithStateAndCityAndDistrict delegate:self];
            self.locatePicker.frame = self.myPickView.frame;
            self.baseTanView.hidden = NO;
            self.locatePicker.tag = indexPath.row;
            _signNum = (int)indexPath.row;
            _NBStr = [NSString stringWithFormat:@"%@ %@ %@", @"上海", @"上海市", @"南汇区"];
            [self.locatePicker showInView:self.view];
            self.myTableView.userInteractionEnabled = NO;
            self.grayView.hidden = NO;
        }else if (indexPath.row == 2)
        {
            self.datePickView.hidden = NO;
            self.baseTanView.hidden = NO;
            _signNum = (int)indexPath.row;
            NSDate *select  = [self.datePickView date];
            NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
            [dateFormatter setDateFormat:@"yyyy-MM-dd"];
            _NBStr = [dateFormatter stringFromDate:select];
            self.myTableView.userInteractionEnabled = NO;
            self.grayView.hidden = NO;
        }else if (indexPath.row == 0&&indexPath.section ==1)
        {
            UITextField * myTF = [self.view viewWithTag:600];
            myTF.hidden = NO;
            myTF.borderStyle = UITextBorderStyleRoundedRect;
            myTF.placeholder = @"请输入昵称";
            myTF.font = [UIFont fontWithName:@"Arial" size:14.0f];
            myTF.text = self.myUserDic[NICHEN_KEY];
        }else if(indexPath.row ==6)
        {
            UIStoryboard *xpSb = [UIStoryboard storyboardWithName:@"XPRZViewController" bundle:nil];
            
            XPRZViewController * xpvc = [xpSb instantiateViewControllerWithIdentifier:@"XPRZViewController"];
            self.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:xpvc animated:YES];
            
        }

    }
    else if(self.isGoToZeOu)
    {
        if (indexPath.row != 0 && indexPath.row != 1&&indexPath.row != 6 && indexPath.row != 10) {
            CFinfoModel * infoModel = [CFinfoModel new];
            self.stringsArray = infoModel.zeouArry[indexPath.row];
            self.baseTanView.hidden = NO;
            self.pickNewView = [[UIPickerView alloc]initWithFrame:self.myPickView.frame];
            self.pickNewView.backgroundColor = [UIColor whiteColor];
            self.pickNewView.tag = indexPath.row;
            [self.pickNewView selectRow:0 inComponent:0 animated:YES];
            self.pickNewView.delegate =self;
            self.pickNewView.dataSource = self;
            _NBStr = self.stringsArray[0];
            [self.baseTanView addSubview:self.pickNewView];
            self.myTableView.userInteractionEnabled = NO;
            self.grayView.hidden = NO;
            _signNum = (int)indexPath.row;
        }else if (indexPath.row == 6||indexPath.row ==1)
        {
            self.locatePicker = [[HZAreaPickerView alloc] initWithStyle:HZAreaPickerWithStateAndCityAndDistrict delegate:self];
            self.locatePicker.frame = self.myPickView.frame;
            self.baseTanView.hidden = NO;
            self.locatePicker.tag = indexPath.row;
            _signNum = (int)indexPath.row;
            _NBStr = [NSString stringWithFormat:@"%@ %@ %@", @"上海", @"上海市", @"南汇区"];
            [self.locatePicker showInView:self.view];
            self.myTableView.userInteractionEnabled = NO;
            self.grayView.hidden = NO;
        }
        else if (indexPath.row == 0)
        {
            self.datePickView.hidden = NO;
            self.baseTanView.hidden = NO;
            _signNum = (int)indexPath.row;
            NSDate *select  = [self.datePickView date];
            self.datePickView.tag = indexPath.row;
            NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
            [dateFormatter setDateFormat:@"yyyy-MM-dd"];
            _NBStr = [dateFormatter stringFromDate:select];
            self.myTableView.userInteractionEnabled = NO;
            self.grayView.hidden = NO;
        }else if (indexPath.row == 10)
        {
            UIStoryboard * choseSB =[UIStoryboard storyboardWithName:@"ChoseOtherViewController" bundle:nil];
            ChoseOtherViewController * choseVC = [choseSB instantiateViewControllerWithIdentifier:@"ChoseOtherViewController"];
            self.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:choseVC animated:YES];
        }
        
    }
    else if(self.isGoToHunYinGuanNian)
    {
        if (indexPath.row != 16 && indexPath.row != 17) {
            [self addPickViewWithIndexPath:indexPath];
        }else{
            [self goDouXuanWithIndexPath:indexPath];
        }
    }
    else if(self.isGoToQinMiShiJiao)
    {
        if (indexPath.row < 6) {
            [self addPickViewWithIndexPath:indexPath];
        }else{
            [self goDouXuanWithIndexPath:indexPath];
        }
        
    }
    else if(self.isGoToDate)
    {
        if(indexPath.row == 1)
        {
            [self addPickViewWithIndexPath:indexPath];
        }else
        {
            [self goDouXuanWithIndexPath:indexPath];
        }
    }
    else{
        if (indexPath.section == 1 && indexPath.row != 4) {
            CFinfoModel * infoModel = [CFinfoModel new];
            self.stringsArray = infoModel.JinJiArry[indexPath.row];
            self.baseTanView.hidden = NO;
            self.pickNewView = [[UIPickerView alloc]initWithFrame:self.myPickView.frame];
            self.pickNewView.backgroundColor = [UIColor whiteColor];
            self.pickNewView.tag = indexPath.row;
            [self.pickNewView selectRow:0 inComponent:0 animated:YES];
            self.pickNewView.delegate =self;
            self.pickNewView.dataSource = self;
            _NBStr = self.stringsArray[0];
            [self.baseTanView addSubview:self.pickNewView];
            self.myTableView.userInteractionEnabled = NO;
            self.grayView.hidden = NO;
            _signNum = (int)indexPath.row;
        }else if(indexPath.row == 4)
        {
            UIStoryboard *xpSb = [UIStoryboard storyboardWithName:@"XPRZViewController" bundle:nil];
            
            XPRZViewController * xpvc = [xpSb instantiateViewControllerWithIdentifier:@"XPRZViewController"];
            xpvc.isGotoJichanRenZhen = YES;
            self.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:xpvc animated:NO];
        }
        
    }
    }
   
}




-(void)showAlertWithSignStr:(NSString *)signStr
{
    self.grayView.hidden = NO;
    if ([signStr isEqualToString:@"payOneYB"]) {
        /** 显示是否支付一约币 **/
        self.AlertLabel.text =@"浏览该信息会扣除您账户1约币";
        [self.SureBtn addTarget:self action:@selector(gotoPayOneYB) forControlEvents:UIControlEventTouchUpInside];
    }else if([signStr isEqualToString:@"YBNotEnough"])
    {
        /** 显示约币不足 是否去充值 **/
        self.AlertLabel.text =@"浏览该信息会扣除您账户1约币,您的约币不足,请去充值";
        [self.SureBtn addTarget:self action:@selector(gotoTopUpYB) forControlEvents:UIControlEventTouchUpInside];
        
    }else if ([signStr isEqualToString:@"InforLose"])
    {
        /** 信息不完整 **/
        self.AlertLabel.text =@"基于对等原则,你需要先完善自己的资料才能查看TA的资料";
        
        [self.SureBtn addTarget:self action:@selector(SuccessGotoWatch:) forControlEvents:UIControlEventTouchUpInside];
    }
    [self.AlertdeleBtn addTarget:self action:@selector(cancelTheAlertView) forControlEvents:UIControlEventTouchUpInside];
    [self.AlertCancelBtn addTarget:self action:@selector(cancelTheAlertView) forControlEvents:UIControlEventTouchUpInside];
    self.myAlertBaseView.layer.cornerRadius = 7;
    self.SureBtn.layer.cornerRadius = 7;
    self.AlertdeleBtn.layer.cornerRadius = 7;
    self.myAlertInfoView.layer.cornerRadius = 7;
}

/** 去充值 **/
-(void)gotoTopUpYB
{
    
    UIStoryboard * TopUpSB = [UIStoryboard storyboardWithName:@"TopUpViewController" bundle:nil];
    TopUpViewController * TopUpVC  = [TopUpSB instantiateViewControllerWithIdentifier:@"TopUpViewController"];
    self.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:TopUpVC animated:YES];
}



/** 付款1约币 **/
-(void)gotoPayOneYB
{
    [self requestTheNetWith:nil andURL:CUTYB_URL andDic:@{@"userId":[Tools getValueFromNSUserDefaultsByKey:USERID],@"money":@"1.00"} andSignStr:CUTMYYB_SIGNSTR];
    
}

/** 取消 **/
-(void)cancelTheAlertView
{
    self.grayView.hidden = YES;
    
}


-(void)addPickViewWithIndexPath:(NSIndexPath*)indexPath
{
    CFinfoModel * infoModel = [CFinfoModel new];
    if (self.isGoToHunYinGuanNian) {
        self.stringsArray = infoModel.HunYinGNArry[indexPath.row];
    }
    else if (self.isGoToDate)
    {
        self.stringsArray = infoModel.YueHuiArry[indexPath.row];
    }
    else if (self.isGoToQinMiShiJiao)
    {
        self.stringsArray = infoModel.QinMiArry[indexPath.row];
    }
    
    self.baseTanView.hidden = NO;
    self.pickNewView = [[UIPickerView alloc]initWithFrame:self.myPickView.frame];
    self.pickNewView.backgroundColor = [UIColor whiteColor];
    self.pickNewView.tag = indexPath.row;
    [self.pickNewView selectRow:0 inComponent:0 animated:YES];
    self.pickNewView.delegate =self;
    self.pickNewView.dataSource = self;
    _NBStr = self.stringsArray[0];
    [self.baseTanView addSubview:self.pickNewView];
    self.myTableView.userInteractionEnabled = NO;
    self.grayView.hidden = NO;
    _signNum = (int)indexPath.row;
}

-(void)goDouXuanWithIndexPath:(NSIndexPath *)indexPath
{
    
    UIStoryboard * choseSB =[UIStoryboard storyboardWithName:@"ChoseOtherViewController" bundle:nil];
    ChoseOtherViewController * choseVC = [choseSB instantiateViewControllerWithIdentifier:@"ChoseOtherViewController"];
    if (self.isGoToHunYinGuanNian) {
        if (indexPath.row ==17) {
            choseVC.isZuiKanZhong =YES;
        }else if (indexPath.row == 16)
        {
            choseVC.isLianRenXiangChu = YES;
        }
    }
    else if (self.isGoToQinMiShiJiao)
    {
      if (indexPath.row == 7)
        {
            choseVC.isDiaoDongInstert = YES;
        }else if (indexPath.row == 8)
        {
            choseVC.isAcceptPartner = YES;
        }else if (indexPath.row == 6)
        {
            choseVC.isQMFindOther = YES;
        }
    }
    else if (self.isGoToDate)
    {
        if (indexPath.row == 0) {
            choseVC.isFirstDateWantDo = YES;
        }else if (indexPath.row == 2)
        {
            choseVC.isDatePlace = YES;
        }else if (indexPath.row ==3)
        {
            choseVC.isRomance = YES;
        }
        else if (indexPath.row==4)
        {
            choseVC.isInterestTalk =YES;
        }else if (indexPath.row ==5)
        {
            choseVC.isWantToSport = YES;
        }
        
    }
   
    self.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:choseVC animated:YES];
}


#pragma mark ---------- textFieldDelegate
-(void)textViewDidChange:(UITextView *)textView
{
    UILabel * label = (UILabel *)[self.view viewWithTag:777];
    label.text = [NSString stringWithFormat:@"%lu/300",(unsigned long)textView.text.length];
    _NBStr= textView.text;
}

-(void)textFieldDidEndEditing:(UITextField *)textField
{
    if (textField.tag == 3001 || textField.tag == 3002 || textField.tag ==3003) {
        _NBStr = textField.text;
    }else{
    _NBStr = textField.text;
    NSLog(@"%@",_NBStr);
    _signNum = 0;
    textField.hidden = YES;
    CFinfoModel * model = [CFinfoModel new];
    ///存储信息
    [model saveTheStrWithStr:_NBStr andKeyStr:model.myKeyArry[_signNum]];
    ///确保拿到最新的本地数据
    _myBaeDic = [self.myUseModel readTheUserDic];

    [self.myTableView reloadData];
    }
}

#pragma mark --- 与DataSource有关的代理方法
//返回列数（必须实现）
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    return 1;
}

//返回每列里边的行数（必须实现）
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    //如果是第一列
    if (component == 0) {
        //返回姓名数组的个数
        return self.stringsArray.count;
    }
    else
    {
        return 1;
        //返回表情数组的个数
        //        return self.iconArray.count;
    }
    
}

#pragma mark --- 与处理有关的代理方法
//设置组件的宽度
- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component
{
    if (component == 0) {
        return ScreenWidth;
    }
    else
    {
        return 80;
    }
    
}
//设置组件中每行的高度
- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component
{
    if (component == 0) {
        return 60;
    }
    else
    {
        return 60;
    }
}
//设置组件中每行的标题row:行
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    if (component == 0) {
        return self.stringsArray[row];
    }
    else
    {
        return self.stringsArray[row];
    }
}


//选中行的事件处理
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
    if (component == 0) {
        NSLog(@"%@",self.stringsArray[row]);
        [pickerView selectedRowInComponent:0];
        //        //重新加载数据
        //                [pickerView reloadAllComponents];
        //        //重新加载指定列的数据
        //                [pickerView reloadComponent:0];
    
    }
    else
    {
        NSLog(@"%@",self.stringsArray[row]);
    }
    _isFirstin = YES;
    _signNum = (int)pickerView.tag;
    _NBStr = self.stringsArray[row];
    [self.myTableView reloadData];
    
}


- (IBAction)datepick:(UIDatePicker *)sender {
    NSDate *select  = [sender date];
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd"];
    _NBStr = [dateFormatter stringFromDate:select];
    _signNum =(int)sender.tag;
    [self.myTableView reloadData];
}



#pragma mark - HZAreaPicker delegate
-(void)pickerDidChaneStatus:(HZAreaPickerView *)picker
{
    _hzLocation = picker.locate;
    _NBStr = [NSString stringWithFormat:@"%@ %@ %@", _hzLocation.state, _hzLocation.city, _hzLocation.district];
    _signNum =(int)picker.tag;
    NSLog(@"_nbstr ====== %@",_NBStr);
    [self.myTableView reloadData];
    
}

-(void)cancelLocatePicker
{
    [self.locatePicker cancelPicker];
    self.locatePicker.delegate = nil;
    self.locatePicker = nil;
}
#pragma mark --------点击了确定保存
- (IBAction)makeSaveBtn:(UIButton *)sender {
    CFinfoModel * model = [CFinfoModel new];
 
    ///存储信息
    ///确保拿到最新的本地数据
    if (self.isGoToBaseInforTable) {
        [model saveTheStrWithStr:_NBStr andKeyStr:model.myKeyArry[_signNum]];
         _myBaeDic = [self.myUseModel readTheUserDic];
    }else if(self.isGoToZeOu)
    {
        [model saveTheusualDicDetialStr:_NBStr andKeyStr:model.otherArry[_signNum] andDicName:MY_ZEOU_DIC];
        _myZeOuDic = [self.myUseModel readTheUsualDicWithStr:MY_ZEOU_DIC];
    }else if (self.isGoToHunYinGuanNian)
    {
        
       [model saveTheusualDicDetialStr:_NBStr andKeyStr:model.marryGNKeyArry[_signNum] andDicName:MY_HUNYINGUANNIAN_DIC];
        _myHunYinGNDic = [self.myUseModel readTheUsualDicWithStr:MY_HUNYINGUANNIAN_DIC];
    }else if (self.isGoToQinMiShiJiao)
    {
        [model saveTheusualDicDetialStr:_NBStr andKeyStr:model.thinkKeyArry[_signNum] andDicName:MY_QINGMI_DIC];
        _myHunYinGNDic = [self.myUseModel readTheUsualDicWithStr:MY_QINGMI_DIC];

    }else if (self.isGoToDate)
    {
        [model saveTheusualDicDetialStr:_NBStr andKeyStr:model.dateKeyArry[_signNum] andDicName:MY_DATE_DIC];
        _myHunYinGNDic = [self.myUseModel readTheUsualDicWithStr:MY_DATE_DIC];
    }else if (self.isGoToMyAdvantage)
    {
        NSLog(@"点击了保存我的优势");
      
    }
    else
    {
        [model saveTheMoneyStrWithStr:_NBStr andKeyStr:model.moneyArry[_signNum]];
        
        _myMoneyDic = [self.myUseModel readTheMoneyDic];
        NSLog(@"_myMoneyDic ==== %@",_myMoneyDic);
    }
    
   
    
    
    self.baseTanView.hidden =YES;
    self.myPickView.hidden= YES;
    self.datePickView.hidden =YES;
    self.myTableView.userInteractionEnabled =YES;
    [self.pickNewView removeFromSuperview];
    [self cancelLocatePicker];
    [self.myTableView reloadData];
    self.myTableView.userInteractionEnabled = YES;
    self.grayView.hidden = YES;
}


#pragma mark --------点击了取消
- (IBAction)cancelBtn:(UIButton *)sender {
  
    self.myPickView.hidden= YES;
    self.datePickView.hidden =YES;
    self.grayView.hidden = YES;
    self.baseTanView.hidden =YES;
    self.myTableView.userInteractionEnabled =YES;
    [self.pickNewView removeFromSuperview];
    [self cancelLocatePicker];
    
    
}
#pragma mark -------点击了保存
- (IBAction)saveAllChange:(UIButton *)sender {
    
 
    if (_isGoToBaseInforTable) {
        _myBaeDic = [self.myUseModel readTheUserDic];
        NSLog(@"_myBaeDic  =======  %@",_myBaeDic);
        self.myDicModel.isGoToBaseInfor= YES;
       /**  处理基本资料的字典  **/
        NSDictionary * sendInfoDic = [NSDictionary new];
     sendInfoDic = [self.myDicModel backWithDic:_myBaeDic]; ///处理基本资料的字典
        [self requestTheNetWith:nil andURL:UPDATEMYBASEINFO_URL andDic:sendInfoDic];
    }
    else if(self.isGoToZeOu)
    {
        _myZeOuDic = [self.myUseModel readTheUsualDicWithStr:MY_ZEOU_DIC];
        self.myDicModel.isGoToZOu = YES;
        /** 处理择偶标准的字典 **/
        NSDictionary * sendZeOuDic = [NSDictionary new];
    sendZeOuDic = [self.myDicModel backWithDic:_myZeOuDic];///处理择偶标准的字典
        [self requestTheNetWith:nil andURL:UPDATEMYZEOU_URL andDic:sendZeOuDic];
    }else if (self.isGoToHunYinGuanNian)
    {
        
        _myHunYinGNDic = [self.myUseModel readTheUsualDicWithStr:MY_HUNYINGUANNIAN_DIC];
        NSArray * myarr = self.myUseModel.marryGNKeyArry;
        NSMutableDictionary * sendHYGNdic =[NSMutableDictionary new];
        for (int i= 0; i<myarr.count; i++)
        {
            [sendHYGNdic setObject:_myHunYinGNDic[myarr[i]] forKey:myarr[i]];
        }
        [sendHYGNdic setObject:[NSString stringWithFormat:@"%@",[Tools getValueFromNSUserDefaultsByKey:USERID]] forKey:@"userId"];
        [self requestTheNetWith:nil andURL:UPDATEMYHUNYINGN_URL andDic:sendHYGNdic];
      
    }else if (self.isGoToDate)
    {
        _myHunYinGNDic = [self.myUseModel readTheUsualDicWithStr:MY_DATE_DIC];
        ///处理约会交往的字典
        NSDictionary * qinMiDic = [NSDictionary new];
        self.myDicModel.isGoToDat = YES;
        NSLog(@"qinmiDic ======== %@",_myHunYinGNDic);
        qinMiDic = [self.myDicModel backWithDic:_myHunYinGNDic]; ///处理约会交往的字典
        [self requestTheNetWith:nil andURL:UPDATEMYDATE_URL andDic:qinMiDic];

        
    }else if (self.isGoToQinMiShiJiao)
    {
        _myHunYinGNDic = [self.myUseModel readTheUsualDicWithStr:MY_QINGMI_DIC];
       ///处理亲密视觉的字典
        NSDictionary * qinMiDic = [NSDictionary new];
        self.myDicModel.isGoToQMShiJiao = YES;
        NSLog(@"qinmiDic ======== %@",_myHunYinGNDic);
        qinMiDic = [self.myDicModel backWithDic:_myHunYinGNDic];///处理亲密视觉的字典
        [self requestTheNetWith:nil andURL:UPDATEMYQINMI_URL andDic:qinMiDic];
    }
    else if (self.isGoToMyAdvantage)
    {
        NSLog(@"点击了保存我的优势");
        NSMutableDictionary * mynewDic =[NSMutableDictionary dictionaryWithDictionary:self.myUserDic[@"user"]] ;
        [mynewDic setObject:_NBStr forKey:MY_ADVANTAGE_KEY];
        [self.myUseModel  saveTheUsualDic:mynewDic andWithDicName:MY_BIGGEST_INFO_DIC];
        /**  处理我的优势  **/
        self.myDicModel.isGoToMyAdvantage = YES;
        NSDictionary * sendInfoDic = [NSDictionary new];
        sendInfoDic = [self.myDicModel backWithDic:[self.myUseModel readBiggestDic]]; ///处理我的优势
        [self requestTheNetWith:nil andURL:UPDATEMYBASEINFO_URL andDic:sendInfoDic];
        
    }
    else if (self.isGoToFriendLookMe)
    {
        NSLog(@"点击了朋友看我");
       NSMutableDictionary * mynewDic =[NSMutableDictionary dictionaryWithDictionary:self.myUserDic[@"user"]] ;
        [mynewDic setObject:_NBStr forKey:FRIEND_LOOKME_KEY];
        [self.myUseModel  saveTheUsualDic:mynewDic andWithDicName:MY_BIGGEST_INFO_DIC];
        /**  处理我的优势  **/
        self.myDicModel.isGoToFriend= YES;
        NSDictionary * sendInfoDic = [NSDictionary new];
        sendInfoDic = [self.myDicModel backWithDic:[self.myUseModel readBiggestDic]]; ///处理我的优势
        [self requestTheNetWith:nil andURL:UPDATEMYBASEINFO_URL andDic:sendInfoDic];
        
    }else if (self.isGoToContancet)
    {
        UITextField * mytextField = (UITextField *)[self.view viewWithTag:3001];
        [mytextField endEditing:YES];
        NSMutableDictionary * mynewDic =[NSMutableDictionary dictionaryWithDictionary:self.myUserDic[CONTANCT_DIC_KEY]] ;
        [mynewDic setObject:_NBStr forKey:CELLPHONE_KEY];
        [self.myUseModel  saveTheUsualDic:mynewDic andWithDicName:MY_BIGGEST_INFO_DIC];
        /**  处理电话号码  **/
        self.myDicModel.isGoToContancet= YES;
        NSDictionary * sendInfoDic = [NSDictionary new];
        sendInfoDic = [self.myDicModel backWithDic:[self.myUseModel readBiggestDic]];
        [self requestTheNetWith:nil andURL:UPDATEMYCONTANCT_URL andDic:sendInfoDic];
        
    }
    else if (self.isGoToWeChat)
    {
        UITextField * mytextField = (UITextField *)[self.view viewWithTag:3002];
        [mytextField endEditing:YES];
        NSMutableDictionary * mynewDic =[NSMutableDictionary dictionaryWithDictionary:self.myUserDic[CONTANCT_DIC_KEY]] ;
        [mynewDic setObject:_NBStr forKey:WECHAT_KEY];
        [self.myUseModel  saveTheUsualDic:mynewDic andWithDicName:MY_BIGGEST_INFO_DIC];
        /**  处理微信号码  **/
        self.myDicModel.isGoToWeChat= YES;
        NSDictionary * sendInfoDic = [NSDictionary new];
        sendInfoDic = [self.myDicModel backWithDic:[self.myUseModel readBiggestDic]];
        [self requestTheNetWith:nil andURL:UPDATEMYCONTANCT_URL andDic:sendInfoDic];
    }
    else if (self.isGoToQQ)
    {
        UITextField * mytextField = (UITextField *)[self.view viewWithTag:3003];
        [mytextField endEditing:YES];
        NSMutableDictionary * mynewDic =[NSMutableDictionary dictionaryWithDictionary:self.myUserDic[CONTANCT_DIC_KEY]] ;
        [mynewDic setObject:_NBStr forKey:QQ_KEY];
        [self.myUseModel  saveTheUsualDic:mynewDic andWithDicName:MY_BIGGEST_INFO_DIC];
        /**  处理qq号码  **/
        self.myDicModel.isGoToQQ= YES;
        NSDictionary * sendInfoDic = [NSDictionary new];
        sendInfoDic = [self.myDicModel backWithDic:[self.myUseModel readBiggestDic]];
        [self requestTheNetWith:nil andURL:UPDATEMYCONTANCT_URL andDic:sendInfoDic];
    }
    else
    {
        _myMoneyDic = [self.myUseModel readTheMoneyDic];
        NSDictionary * sendMoneyDic = @{EARN_MONEY_KEY:_myMoneyDic[EARN_MONEY_KEY],CUNKUAN_MONEY_KEY:_myMoneyDic[CUNKUAN_MONEY_KEY],HOUSE_KEY:_myMoneyDic[HOUSE_KEY],CAR_PRICE_KEY:_myMoneyDic[CAR_PRICE_KEY],@"userId":_myMoneyDic[@"userId"]};
        [self requestTheNetWith:nil andURL:UPDATEMYMONEY_URL andDic:sendMoneyDic];
    }
    
    
}






- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}






#pragma mark --------------网络请求
-(void)requestTheNetWith:(NSArray *)myRequestArry andURL:(NSString *)myurl andDic:(NSDictionary *)myDic;
{
    if (myRequestArry.count>0) {
        [[LJFNetworkingManager shareManager] POST:myurl upLoadImages:myRequestArry parameters:myDic success:^(id returnData, int code, NSString *msg) {
            NSLog(@"%@",msg);
            
           
        } failure:^(NSError *error) {
            NSLog(@"失败");
        
        } showHUD:self.view];
        [self.myTableView reloadData];
    }else
    {
        [[LJFNetworkingManager shareManager] POST:myurl parameters:myDic success:^(id returnData, int code, NSString *msg) {
            NSLog(@"%@",msg);
            if (_isGoToBaseInforTable) {
                self.myUserDic[@"user"] = [NSMutableDictionary dictionaryWithDictionary:_myBaeDic];
                [self.myUseModel saveTheBiggestDic:self.myUserDic];
            } else if(self.isGoToZeOu)
            {
                self.myUserDic[@"mateStandard"] =[NSMutableDictionary dictionaryWithDictionary:_myZeOuDic];
                [self.myUseModel saveTheBiggestDic:self.myUserDic];
            }else if (self.isGoToHunYinGuanNian)
            {
                self.myUserDic[MY_HUNYINGUANNIAN_DIC] =[NSMutableDictionary dictionaryWithDictionary:_myHunYinGNDic];
                [self.myUseModel saveTheBiggestDic:self.myUserDic];
            }else if (self.isGoToDate)
            {
                self.myUserDic[MY_DATE_DIC] =[NSMutableDictionary dictionaryWithDictionary:_myHunYinGNDic];
                [self.myUseModel saveTheBiggestDic:self.myUserDic];
            }else if (self.isGoToQinMiShiJiao)
            {
                self.myUserDic[MY_QINGMI_DIC] =[NSMutableDictionary dictionaryWithDictionary:_myHunYinGNDic];
                [self.myUseModel saveTheBiggestDic:self.myUserDic];
            }
            else if (self.isGoToMyAdvantage)
            {
                NSMutableDictionary * mynewDic =[NSMutableDictionary dictionaryWithDictionary:self.myUserDic[@"user"]] ;
                [mynewDic setObject:_NBStr forKey:MY_ADVANTAGE_KEY];
                self.myUserDic[@"user"] = mynewDic;
                 [self.myUseModel saveTheBiggestDic:self.myUserDic];

            }
            else if (self.isGoToFriendLookMe)
            {
               NSMutableDictionary * mynewDic =[NSMutableDictionary dictionaryWithDictionary:self.myUserDic[@"user"]] ;
                [mynewDic setObject:_NBStr forKey:FRIEND_LOOKME_KEY];
                self.myUserDic[@"user"] = mynewDic;
                [self.myUseModel saveTheBiggestDic:self.myUserDic];
            }
            else if (self.isGoToContancet)
            {
                NSMutableDictionary * mynewDic =[NSMutableDictionary dictionaryWithDictionary:self.myUserDic[CONTANCT_DIC_KEY]] ;
                [mynewDic setObject:_NBStr forKey:CELLPHONE_KEY];
                self.myUserDic[CONTANCT_DIC_KEY] = mynewDic;
                [self.myUseModel saveTheBiggestDic:self.myUserDic];
            }
            else if (self.isGoToWeChat)
            {
                NSMutableDictionary * mynewDic =[NSMutableDictionary dictionaryWithDictionary:self.myUserDic[CONTANCT_DIC_KEY]] ;
                [mynewDic setObject:_NBStr forKey:WECHAT_KEY];
                self.myUserDic[CONTANCT_DIC_KEY] = mynewDic;
                [self.myUseModel saveTheBiggestDic:self.myUserDic];
            }
            else if (self.isGoToQQ)
            {
                NSMutableDictionary * mynewDic =[NSMutableDictionary dictionaryWithDictionary:self.myUserDic[CONTANCT_DIC_KEY]] ;
                [mynewDic setObject:_NBStr forKey:QQ_KEY];
                self.myUserDic[CONTANCT_DIC_KEY] = mynewDic;
                [self.myUseModel saveTheBiggestDic:self.myUserDic];
            }
            else
            {
                self.myUserDic[@"money"] = [NSMutableDictionary dictionaryWithDictionary:_myMoneyDic];
                [self.myUseModel saveTheBiggestDic:self.myUserDic];
            }
            
            [self.navigationController popViewControllerAnimated:YES];
        } failure:^(NSError *error) {
            NSLog(@"%@",error);
        } showHUD:self.view andisJsonString:nil];
        
    }
    
    
}


#pragma mark --------------网络请求
-(void)requestTheNetWith:(NSArray *)myRequestArry andURL:(NSString *)myurl andDic:(NSDictionary *)myDic andSignStr:(NSString *)signStr;
{
            [[LJFNetworkingManager shareManager] POST:myurl parameters:myDic success:^(id returnData, int code, NSString *msg) {
            NSLog(@"%@",msg);
            
        
                if (code == 1) {
                    _cutYB = YES;
                    self.grayView.hidden= YES;
                    [self SuccessGotoWatch:YES];
                }else{
                    _cutYB = NO;
                    [self showAlertWithSignStr:@"YBNotEnough"];
                }
                
    } failure:^(NSError *error) {
            NSLog(@"%@",error);
            if ([signStr isEqualToString:CUTMYYB_SIGNSTR])
            {
                _cutYB = NO;
                self.grayView.hidden= YES;
                [self showAlertWithSignStr:@"YBNotEnough"];
            }
            
        } showHUD:self.view];
    
    
}

-(void)SuccessGotoWatch:(BOOL)isLookOther
{
    self.grayView.hidden = YES;
    if (self.isGoToOther) {
        if (self.isGoToHunYinGuanNian) {
            
            switch (_clickTag) {
                case AFTERMARRYMIYOU_SIGNSTR:
                    _goreloadNum = 4;
                    _cutYB = YES;
                    break;
                case FINDOTHERONENIGHT_SIGNSTR:
                    _goreloadNum = 7;
                    _cutYB = YES;
                    break;
                case OTHERFAMILY_SIGNSTR:
                    _goreloadNum = 11;
                    _cutYB = YES;
                    break;
                case AFTERWITHPARENTS_SIGNSTR:
                    _goreloadNum = 14;
                    _cutYB = YES;
                    break;
                case OTHERINTERSET_SIGNSTR:
                    _goreloadNum = 17;
                    _cutYB = YES;
                    _goJump = YES;
                    
                    break;
                    
                default:
                    break;
            }
            
            if (_goJump) {
                [self goChoseOtherView:_goreloadNum];
            }else{
            NSIndexPath *indexPath=[NSIndexPath indexPathForRow:_goreloadNum inSection:0];
            [self.myTableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
            }
        }
        else if (self.isGoToDate)
        {
            if (_clickTag  == FIRSTMEETTODO_SIGNSTR) {
                _goreloadNum = 0;
                [self goChoseOtherView:_goreloadNum];
            }
        }else if (self.isGoToQinMiShiJiao)
        {
                
                switch (_clickTag) {
                    case THINKESEX_SIGNSTR:
                        _goreloadNum = 1;
                        _cutYB = YES;
                        break;
                    case SEXEXP_SIGNSTR:
                        _goreloadNum = 2;
                        _cutYB = YES;
                        break;
                    case SEXTOUHGHT_SIGNSTR:
                        _goreloadNum = 3;
                        _cutYB = YES;
                        break;
                    case SEXZISHI_SIGNSTR:
                        _goreloadNum = 4;
                        _cutYB = YES;
                        break;
                    case OTHERINTERSET_SIGNSTR:
                        _goreloadNum = 7;
                        _cutYB = YES;
                        _goJump = YES;
                        
                        break;
                        
                    default:
                        break;
                }
                
                if (_goJump) {
                    [self goChoseOtherView:_goreloadNum];
                }else{
                    NSIndexPath *indexPath=[NSIndexPath indexPathForRow:_goreloadNum inSection:0];
                    [self.myTableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
                }

        }
    
    
    
    }
    
}


-(void)goChoseOtherView:(int)num
{
    UIStoryboard * choseSB =[UIStoryboard storyboardWithName:@"ChoseOtherViewController" bundle:nil];
    ChoseOtherViewController * choseVC = [choseSB instantiateViewControllerWithIdentifier:@"ChoseOtherViewController"];
    if (self.isGoToHunYinGuanNian) {
        if (num==17) {
            choseVC.isZuiKanZhong =YES;
        }else if (num == 16)
        {
            choseVC.isLianRenXiangChu = YES;
        }
    }
    else if (self.isGoToQinMiShiJiao)
    {
        if (num == 7)
        {
            choseVC.isDiaoDongInstert = YES;
        }else if (num == 8)
        {
            choseVC.isAcceptPartner = YES;
        }else if (num == 6)
        {
            choseVC.isQMFindOther = YES;
        }
    }
    else if (self.isGoToDate)
    {
        if (num == 0) {
            choseVC.isFirstDateWantDo = YES;
        }else if (num == 2)
        {
            choseVC.isDatePlace = YES;
        }else if (num ==3)
        {
            choseVC.isRomance = YES;
        }
        else if (num==4)
        {
            choseVC.isInterestTalk =YES;
        }else if (num ==5)
        {
            choseVC.isWantToSport = YES;
        }
        
    }
    choseVC.isOther = YES;
    self.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:choseVC animated:YES];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
